package com.zhanglingfei.yuekaoshop.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

import javax.persistence.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author Shichao.Lu
 * null
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Entity
@Table(name = "tb_order")
@DynamicInsert
@DynamicUpdate
public class Order implements Serializable {


	@OneToMany(mappedBy = "orderId")
	private List<OrderDetail> orderDetailList;



	/**
	 * 订单id
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "order_id")
	private Long orderId;

	/**
	 * 总金额，单位为分
	 */
	@Column(name = "total_pay")
	private Long totalPay;

	/**
	 * 实付金额。单位:分。如:20007，表示:200元7分
	 */
	@Column(name = "actual_pay")
	private Long actualPay;

	/**
	 * null
	 */
	@Column(name = "promotion_ids")
	private String promotionIds;

	/**
	 * 支付类型，1、在线支付，2、货到付款
	 */
	@Column(name = "payment_type")
	private Boolean paymentType;

	/**
	 * 邮费。单位:分。如:20007，表示:200元7分
	 */
	@Column(name = "post_fee")
	private Long postFee;

	/**
	 * 订单创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "create_time")
	private java.util.Date createTime;

	/**
	 * 物流名称
	 */
	@Column(name = "shipping_name")
	private String shippingName;

	/**
	 * 物流单号
	 */
	@Column(name = "shipping_code")
	private String shippingCode;

	/**
	 * 用户id
	 */
	@Column(name = "user_id")
	private String userId;

	/**
	 * 买家留言
	 */
	@Column(name = "buyer_message")
	private String buyerMessage;

	/**
	 * 买家昵称
	 */
	@Column(name = "buyer_nick")
	private String buyerNick;

	/**
	 * 买家是否已经评价,0未评价，1已评价
	 */
	@Column(name = "buyer_rate")
	private Boolean buyerRate;

	/**
	 * 收获地址（省）
	 */
	@Column(name = "receiver_state")
	private String receiverState;

	/**
	 * 收获地址（市）
	 */
	@Column(name = "receiver_city")
	private String receiverCity;

	/**
	 * 收获地址（区/县）
	 */
	@Column(name = "receiver_district")
	private String receiverDistrict;

	/**
	 * 收获地址（街道、住址等详细地址）
	 */
	@Column(name = "receiver_address")
	private String receiverAddress;

	/**
	 * 收货人手机
	 */
	@Column(name = "receiver_mobile")
	private String receiverMobile;

	/**
	 * 收货人邮编
	 */
	@Column(name = "receiver_zip")
	private String receiverZip;

	/**
	 * 收货人
	 */
	@Column(name = "receiver")
	private String receiver;

	/**
	 * 发票类型(0无发票1普通发票，2电子发票，3增值税发票)
	 */
	@Column(name = "invoice_type")
	private Integer invoiceType;

	/**
	 * 订单来源：1:app端，2：pc端，3：M端，4：微信端，5：手机qq端
	 */
	@Column(name = "source_type")
	private Integer sourceType;
}
